<template>
    <div class="ma-content-block flex flex_column p-4" style="height: 85vh">
      <div class="flex justify-between home-page-title" style="margin-bottom: 2%">
        <div class="flex">
          
          <div class='flex align_center' >
            <div style="text-align:end;width:100px;margin-right:10px">类型：</div>
            <a-select v-model="type_id" placeholder="请选择类型">
                <a-option
                    v-for="(item,index) in typeList"
                    :value="item?.value"
                    :label="item?.label"
                    :key="index"
                />
            </a-select>
          </div>
          <div class='flex align_center' style='margin-left: 24px'>
            <div style="text-align:end;width:100px;margin-right:10px">选择公司：</div>
            <a-select v-model="dept_id" placeholder="请选择公司" :filter-option="filterOption" allow-search>
                <a-option
                    v-for="(item,index) in deptList"
                    :value="item?.id"
                    :label="item?.name"
                    :key="index"
                />
            </a-select>
          </div>
          <div class='flex align_center' style='margin-left: 24px'>
              <div>选择时间：</div>
              <div class="datetime flex"  style="width: 300px;margin-left: 24px">
                  <a-range-picker    @change="handleExport($event)" />
              </div>
          </div>
        </div>
        <div class='flex'>
            <a-button type="primary" @click="handleExportData(range_dates)" style='margin-right:24px'>查 询 数 据</a-button>
            <a-button type="primary" @click="handleYunyingFun">导 出</a-button>
        </div>
        
      </div>
      <div class='tableBox' v-dragscroll style="height: 85%;overflow:auto" >
        <div class=" flex flex_column flex_1" style="height: 100%;width:fit-content;">
            <div
            class="flexbox height40 bor_btm"
            style="background: rgba(242, 243, 245, 1)"
            >
            <div style="font-size: 20px; font-weight: 600">
                {{dept_names}} {{th1}}至{{th2}}{{type_id == 1?'到达':'提货'}}数据
            </div>
            </div>
            <div
            class="flexbox height40 bor_btm "
            style="background: rgba(242, 243, 245, 1);justify-content:space-between"
            >
            <div class='flex' style="font-size: 16px; font-weight: 600">
                <div style='width:300px'>经办人：</div>
                <div style='width:300px'>复核人：</div>
            </div>
            <div class='flex' style="font-size: 16px; font-weight: 600">
                <div style='width:600px'>对账日期：{{th1}}至{{th2}}</div>
            </div>
            </div>
            <div
            class="flex"
            style="background: rgba(242, 243, 245, 1); font-weight: 600;"
            >
            <div class=" flexbox bor_right bor_btm" style='width:50px;'>
                <div>序号</div>
            </div>
            <div class=" flexbox bor_right bor_btm" style='width:150px'>
                <div>火车/汽车到达</div>
            </div>
            <div class=" flexbox bor_right bor_btm" style='width:150px'>
                <div>火车车皮号/汽车号</div>
            </div>
            <div class=" flexbox bor_right bor_btm" style='width:150px'>
                <div>箱号</div>
            </div>
            <div class=" flexbox bor_right bor_btm" style='width:150px'>
                <div>发站</div>
            </div>
            <div class=" flexbox bor_right bor_btm" style='width:150px'>
                <div>品名</div>
            </div>
            
            <div class=" flexbox bor_right bor_btm" style='width:150px'>
                <div>重量</div>
            </div>
            <div class=" flexbox bor_right bor_btm" style='width:180px'>
                <div>到达时间</div>
            </div>
            <div class=" flexbox bor_right bor_btm" style='width:180px' v-if='type_id == 2'>
                <div>提货时间</div>
            </div>
            <div class=" flexbox bor_right bor_btm" style='width:150px'>
                <div>集装箱（个）</div>
            </div>
            <div class=" flexbox bor_right bor_btm" style='width:150px' v-if='type_id == 2'>
                <div>仓储/暂存天数</div>
            </div>
            <div class=" flexbox bor_right bor_btm" style='width:300px' v-for='(it,ind) in chare_list' :key='ind'>
                <div class="height40  " style='flex:1'>
                    <div class="flexbox height40 bor_btm">
                        <div>{{it}}</div>
                    </div>
                    <div class='flexbox'>
                        <div class="flexbox height40 flex_1 bor_right">
                            <div>计费公式</div>
                        </div>
                        
                        <div class="flexbox height40 flex_1">
                            <div>金额（元）</div>
                        </div>
                    </div>
                </div>
            </div>
            <div class=" flexbox  bor_btm" style='width:150px'>
                <div>合计金额</div>
            </div>
            </div>
            <div class="flex_1 scrollbar" style="overflow: auto">
                <div v-if='listData.length != 0'>
                    <div class='flex' v-for='(item,index) in listData' :key='index' >
                        <div class=" flex height40" style="width:50px;">
                            <div class="flexbox bor_btm bor_right" style="width:50px;">
                                <div class="pad8">{{item.xuhao}}</div>
                            </div>
                        </div>
                        <div class=" flex height40" style="width: 150px">
                            <div class="flexbox bor_btm bor_right" style="width: 150px">
                                <div class="pad8">{{item.is_car}}</div>
                            </div>
                        </div>
                        <div class=" flex height40" style="width: 150px">
                            <div class="flexbox bor_btm bor_right" style="width: 150px">
                                <div class="pad8">{{item.car_no}}</div>
                            </div>
                        </div>
                        <div class=" flex height40" style="width: 150px">
                            <div class="flexbox bor_btm bor_right" style="width: 150px">
                                <div class="pad8">{{item.box}}</div>
                            </div>
                        </div>
                        <div class=" flex height40" style="width: 150px">
                            <div class="flexbox bor_btm bor_right" style="width: 150px">
                                <div class="pad8">{{item.producer}}</div>
                            </div>
                        </div>
                        <div class=" flex height40" style="width: 150px">
                            <div class="flexbox bor_btm bor_right" style="width: 150px">
                                <div class="pad8">{{item.goods_name}}</div>
                            </div>
                        </div>
                        <div class=" flex height40" style="width: 150px">
                            <div class="flexbox bor_btm bor_right" style="width: 150px">
                                <div class="pad8">{{item.weight}}</div>
                            </div>
                        </div>
                        <div class=" flex height40" style="width: 180px">
                            <div class="flexbox bor_btm bor_right" style="width: 180px">
                                <div class="pad8">{{item.over_time}}</div>
                            </div>
                        </div>
                        <div class=" flex height40" style="width: 180px" v-if='type_id == 2'>
                            <div class="flexbox bor_btm bor_right" style="width: 180px" >
                                <div class="pad8">{{item.zhuangche_time}}</div>
                            </div>
                        </div>
                        <div class=" flex height40" style="width: 150px">
                            <div class="flexbox bor_btm bor_right" style="width: 150px">
                                <div class="pad8">{{item.box_num}}</div>
                            </div>
                        </div>
                        <div class=" flex height40" style="width: 150px" v-if='type_id == 2'>
                            <div class="flexbox bor_btm bor_right" style="width: 150px" >
                                <div class="pad8">{{item.jifei_day}}</div>
                            </div>
                        </div>
                        <div class='flex' v-for='(it,ind) in chare_list' :key='ind'>
                            <div class=" flex height40" style="width: 150px">
                                <div class="flexbox bor_btm bor_right" style="width: 150px">
                                    <div class="pad8">{{ getchare('price_role_',index,ind)}} </div>
                                </div>
                            </div>
                            <div class=" flex height40" style="width: 150px">
                                <div class="flexbox bor_btm bor_right" style="width: 150px">
                                    <div class="pad8">{{ getchare('pay_price_',index,ind)}}</div>
                                </div>
                            </div>
                        </div>
                        <div class=" flex height40" style="width: 150px">
                            <div class="flexbox bor_btm bor_right" style="width: 150px">
                                <div class="pad8">{{item.price_total}}</div>
                            </div>
                        </div>
                    </div>
                    <div class="height40 bor_btm bor_right" style='text-align:left;line-height:40px'>
                        <div class="pad8" style='text-align:left;'>业务合计：</div>
                    </div>
                    <div class='flex'  >
                        <div class=" flex height40" style="width:50px;">
                            <div class="flexbox bor_btm bor_right" style="width:50px;">
                                <div class="pad8">序号</div>
                            </div>
                        </div>
                        <div class=" flex height40" style="width: 150px">
                            <div class="flexbox bor_btm bor_right" style="width: 150px">
                                <div class="pad8">火车/汽车到达</div>
                            </div>
                        </div>
                        <div class=" flex height40" style="width: 150px">
                            <div class="flexbox bor_btm bor_right" style="width: 150px">
                                <div class="pad8">品名</div>
                            </div>
                        </div>
                        <div class=" flex height40" style="width: 150px">
                            <div class="flexbox bor_btm bor_right" style="width: 150px">
                                <div class="pad8">重量</div>
                            </div>
                        </div>
                        <div class=" flex height40" style="width: 150px" v-for='(it,ind) in chare_list' :key='ind'>
                            <div class="flexbox bor_btm bor_right" style="width: 150px">
                                <div class="pad8">{{it}}</div>
                            </div>
                        </div>
                        <div class=" flex height40" style="width: 150px">
                            <div class="flexbox bor_btm bor_right" style="width: 150px">
                                <div class="pad8">合计金额</div>
                            </div>
                        </div>
                    </div>
                    <div class='flex' v-for='(item,index) in total_data' :key='index'>
                        <div class=" flex height40" style="width:50px;">
                            <div class="flexbox bor_btm bor_right" style="width:50px;">
                                <div class="pad8">{{item.xuhao}}</div>
                            </div>
                        </div>
                        <div class=" flex height40" style="width: 150px">
                            <div class="flexbox bor_btm bor_right" style="width: 150px">
                                <div class="pad8">{{item.is_car}}</div>
                            </div>
                        </div>
                        <div class=" flex height40" style="width: 150px">
                            <div class="flexbox bor_btm bor_right" style="width: 150px">
                                <div class="pad8">{{item.goods_name}}</div>
                            </div>
                        </div>
                        <div class=" flex height40" style="width: 150px">
                            <div class="flexbox bor_btm bor_right" style="width: 150px">
                                <div class="pad8">{{getquchu(item.weight,3)}}</div>
                            </div>
                        </div>
                        <div class=" flex height40" style="width: 150px" v-for='(it,ind) in chare_list' :key='ind'>
                            <div class="flexbox bor_btm bor_right" style="width: 150px">
                                <div class="pad8">{{getHejichare('pay_price_',index,ind)}}</div>
                            </div>
                        </div>
                        <div class=" flex height40" style="width: 150px">
                            <div class="flexbox bor_btm bor_right" style="width: 150px">
                                <div class="pad8">{{getquchu(item.price_total,2)}}</div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class='flexbox' style='width:100%;height:100%' v-else>
                    <div >暂无数据</div>
                </div>
            
            </div>
        </div>
      </div>
      
      <div style="padding-bottom: 2%"></div>
      <!-- 加载中... -->
      <div
        v-if="loading"
        style="
          position: fixed;
          width: 100vw;
          height: 100vh;
          background: rgba(0, 0, 0, 0.6);
          z-index: 10;
          display: flex;
          top: 0;
          left: 0;
          justify-content: center;
          align-items: center;
        "
      >
        <a-spin dot :size="10" />
      </div>
    </div>
  </template>
    <script setup>
    import { ref, reactive, onMounted } from "vue";
    import { request } from "@/utils/request.js";
    import financialMoneyFzsr from "@/api/financial/financialMoneyFzsr";
    import { Message } from "@arco-design/web-vue";
    import tool from "@/utils/tool";
    import * as common from "@/utils/common";
    import { ElMapExportTable } from "table-excel";
    import timeFormat from "@/utils/timeFormat.js";
    import { pinyin } from "pinyin-pro"
    const loading = ref(false)
    const range_dates = ref([])
    const th1 = ref('')
    const th2 = ref('')
    const type_id = ref(1)
    const dept_id = ref('')
    const dept_names = ref('')
    const deptList = ref([])
    const typeList = ref([
            {value:1,label:'到达业务账单'},
            {value:2,label:'提货业务账单'},
    ])
    const filterOption = (v,option)=>{
        return option.keywords.some(keywords=>keywords.includes(v))
    }
    const chare_list = ref([])
    const centenNum = ref()   // 主要数据的行数
    const hengNum = ref()   //  纵总数
    const yunyingData = ref()
    const yunyingItem = ref([])
    const listData = ref([])
    const total_data = ref([])
    const newDate = new Date();
    // 当年
    const newYear = newDate.getFullYear();
    // 当月
    const newMonth = (newDate.getMonth() + 1)>9?(newDate.getMonth() + 1):'0' + (newDate.getMonth() + 1);
    // 本月天数
    const newMaxDay = new Date(newYear, newMonth, 0).getDate();
    onMounted(async () => {
        let range_date = [`${newYear}-${newMonth}-01 00:00:00`,`${newYear}-${newMonth}-${newMaxDay} 23:59:59`]
        // let range_date = ['2024-04-01 00:00:00','2024-04-30 23:59:59']
        range_dates.value = [`${newYear}-${newMonth}-01 00:00:00`,`${newYear}-${newMonth}-${newMaxDay} 23:59:59`]
        th1.value = `${newYear}-${newMonth}-01`
        th2.value = `${newYear}-${newMonth}-${newMaxDay}`
        handleDept(range_date)
        
    });
    const getchare = (title,index,indexs) =>{
        let key = ''
        if(title == 'pay_price_'){
            key = (listData.value[index][title + indexs] - 0).toFixed(2)
        }else{
            key = listData.value[index][title + indexs] 
        }
        return key
    }
    const getHejichare = (title,index,indexs) =>{
        let key = (total_data.value[index][title + indexs] - 0).toFixed(2)
        return key
    }
    const getquchu = (title,key)=>{
        return (title - 0).toFixed(key)
    }
    const handleExportData = (range_date) =>{
        yunyingItem.value = []
        listData.value = []
        let index = deptList.value.findIndex(item=>{
            return item.id == dept_id.value
        })
        let dept_name = deptList.value[index].name
        dept_names.value = deptList.value[index].name
        
        let mobanArr = []
        if(type_id.value == 1){
            yunyingData.value = [
                {title:'这是表格名字',children:[
                    {title:`经办人：               复核人：                    对账日期：${range_date[0].split(' ')[0]}至${range_date[1].split(' ')[0]}`,children:[
                        {title:'业务明细： ',children:[
                            {title:'序号',dataIndex:'xuhao'},
                            {title:'火车/汽车到达',dataIndex:'is_car'},
                            {title:'火车车皮号/汽车号',dataIndex:'car_no'},
                            {title:'箱号',dataIndex:'box'},
                            {title:'发站',dataIndex:'producer'},
                            {title:'品名',dataIndex:'goods_name'},
                            {title:'重量',dataIndex:'weight'},
                            {title:'到达时间',dataIndex:'over_time'},
                            {title:'集装箱（个）',dataIndex:'box_num'},
                        ]}
                        
                    ]}
                ]},
                
            ]
            mobanArr = ['xuhao','is_car','car_no','box','producer','goods_name','weight','over_time','box_num']
            yunyingData.value[0].title = `${dept_name} ${range_date[0].split(' ')[0]}至${range_date[1].split(' ')[0]}到达数据`
        }else{
            yunyingData.value = [
                {title:'这是表格名字',children:[
                    {title:`经办人：               复核人：                    对账日期：${range_date[0].split(' ')[0]}至${range_date[1].split(' ')[0]}`,children:[
                        {title:'业务明细： ',children:[
                            {title:'序号',dataIndex:'xuhao'},
                            {title:'火车/汽车到达',dataIndex:'is_car'},
                            {title:'火车车皮号/汽车号',dataIndex:'car_no'},
                            {title:'箱号',dataIndex:'box'},
                            {title:'发站',dataIndex:'producer'},
                            {title:'品名',dataIndex:'goods_name'},
                            {title:'重量',dataIndex:'weight'},
                            {title:'到达时间',dataIndex:'over_time'},
                            {title:'装车时间',dataIndex:'zhuangche_time'},
                            {title:'集装箱（个）',dataIndex:'box_num'},
                            {title:'仓储/暂存天数',dataIndex:'jifei_day'},
                        ]}
                        
                    ]}
                ]},
                
            ]
            mobanArr = ['xuhao','is_car','car_no','box','producer','goods_name','weight','over_time','zhuangche_time','box_num','jifei_day']
            yunyingData.value[0].title = `${dept_name} ${range_date[0].split(' ')[0]}至${range_date[1].split(' ')[0]}提货数据`
        }
        
        
        
      loading.value = true
      request({
        url:'/prediction/Tz/yunyingjiesuan',
        params:{
            type:type_id.value,
            dept_id:dept_id.value,
            date:range_date,
        }
        }).then(res=>{
            
            
            let _data = res.data
            chare_list.value = res.data.chare_list
            total_data.value = res.data.total_data
            total_data.value.map((v,i)=>{
                v.xuhao = i + 1
                v.price_total = (v.price_total - 0).toFixed(2)
                v.weight = (v.weight - 0).toFixed(3)
            })
            
            total_data.value[total_data.value.length - 1].xuhao = '合计'
            // 表格表头重做
            let oneArr = []
            _data.chare_list.map((v,i)=>{
                oneArr.push({title:v,children:[{title:'计费公式',dataIndex:'price_role_' + i},{title:'金额（元）',dataIndex:'pay_price_' + i}]})
            })
            oneArr.push({title:'合计金额',dataIndex:'price_total'})
            yunyingData.value[0].children[0].children[0].children.push(...oneArr)
            // 这是数据重组
            _data.data.map((v,i)=>{
                v.xuhao = i + 1
                v.price_total = (v.price_total - 0).toFixed(2)
                v.weight = (v.weight - 0).toFixed(3)
            })
            _data.data[_data.data.length - 1].xuhao = '合计'
            centenNum.value = _data.data.length
            
            //  这是数据重组的合计数据
            
            _data.chare_list.map((v,i)=>{
                mobanArr.push('pay_price_' + i)
                mobanArr.push('price_role_' + i)
            })
            mobanArr.push('price_total')
            hengNum.value = mobanArr.length
            // 这是拼合计的数据
            let zongData = []
            _data.total_data.map((v,i)=>{
                let pinZongArr = {}
                pinZongArr['xuhao'] = i + 1
                pinZongArr['is_car'] = v.is_car
                pinZongArr['car_no'] = v.goods_name
                pinZongArr['box'] = (v.weight - 0).toFixed(3)
                _data.chare_list.map((vv,ii)=>{
                    // console.log('pay_price_' + ii,v['pay_price_' + ii])
                    pinZongArr[mobanArr[3 + ii + 1]] = (v['pay_price_' + ii] - 0).toFixed(2)
                })
                pinZongArr[mobanArr[4 + _data.chare_list.length]] = (v.price_total - 0).toFixed(2)
                zongData.push(pinZongArr)
            })
            zongData[zongData.length - 1].xuhao = '合计'
            _data.total_data.map((v,i)=>{
                if(i == 0){
                    let pinZongArr = {}
                    pinZongArr['xuhao'] = '序号'
                    pinZongArr['is_car'] = '火车/汽车到达'
                    pinZongArr['car_no'] = '品名'
                    pinZongArr['box'] = '重量'
                    _data.chare_list.map((vv,ii)=>{
                        pinZongArr[mobanArr[3 + ii + 1]] = vv
                    })
                    pinZongArr[mobanArr[4 + _data.chare_list.length]] = '合计金额'
                    zongData.unshift(pinZongArr)
                }
                
            })
            listData.value = _data.data
            zongData.unshift({xuhao:'业务合计：'})
            zongData.unshift({xuhao:''})
            yunyingItem.value = [..._data.data,...zongData]
            loading.value = false
            // 点击导出表格
            // handleYunyingFun()
        }).catch(rej=>{
            loading.value = false
        })
  }
  const handleDept = (range_date)=>{
        request({
            url:'/system/dept/remote',
            method: 'post',
            data:{
                // 开启分页
                openPage: false,
                // 远程请求配置项
                remoteOption: {
                    // 按用户名排序
                    // 设置查询的字段
                    select: ["id", "name"],
                    // 设置数据过滤
                    filter: {
                        type: ["=", 2],
                        status: ['=',1]
                    },
                },
            }
        }).then(res=>{
            res.data.map((v,i)=>{
                    v.keywords = [
                    v.name,
                    pinyin(v.name,{toneType:'none',pattern:'first'}).split(' ').join(''),
                    pinyin(v.name,{toneType:'none',pattern:'first'}).split(' ').join('').toUpperCase()
                    ]
            })
            deptList.value = res.data
            dept_id.value = res.data[0].id
            dept_names.value = res.data[0].name
            handleExportData(range_date)
        })
    }
  // 点击触发导出运营表格
const handleYunyingFun = ()=>{
    let index = deptList.value.findIndex(item=>{
        return item.id == dept_id.value
    })
    let dept_name = deptList.value[index].name
    let title = `${dept_name} ${range_dates.value[0].split(' ')[0]}至${range_dates.value[1].split(' ')[0]}数据`
    const instance = new ElMapExportTable(
        {
            column:yunyingData.value,
            data:yunyingItem.value,
            spanMethod: ({ rowIndex, columnIndex }) => {
                return yunyingFormData(rowIndex,columnIndex)
            },
            setRowStyle({ columnIndex, rowIndex, type }) {
                return {
                    height: 20,
                    width:20,
                    alignment: {
                        horizontal: 'left', // 设置文本左对齐
                    },
                };
            },
          },
        // {progress: progress => console.log(progress)}
      );
      instance.download(title);
}
const yunyingFormData = (rowIndex,columnIndex) =>{
    if (rowIndex  === centenNum.value && columnIndex === 0) {
        return {
            rowspan: 1,
            colspan: hengNum.value,
        };
    }
    if (rowIndex  === centenNum.value + 1 && columnIndex === 1) {
        return {
            rowspan: 1,
            colspan: hengNum.value - 1,
        };
    }
}
  const handleExport = async(e,tab)=>{
      let arr1 = e[0].split(' ')
      let arr2 = e[1].split(' ')
      th1.value = e[0].split(' ')[0]
      th2.value = e[1].split(' ')[0]
      range_dates.value = [arr1[0] + ' 00:00:00',arr2[0] + ' 23:59:59']
      
  }
  </script>
    <style scoped lang="less">
    .align_center{
        align-items: center;
    }
  .home-page-title {
    align-items: center !important;
  
    img {
      height: 30px;
    }
  
    .datetime {
      align-items: center;
      p {
        font-size: 20px;
        color: #415b73;
        margin-left: 20px;
        font-style: italic;
      }
  
      span {
        width: 64px;
        border-radius: 32px;
        padding: 4px 0;
        display: flex;
        justify-content: center;
        align-items: center;
        margin-right: 20px;
        color: #00a0e9;
        border: 1px solid #00a0e9;
        font-size: 14px;
        font-weight: 400;
        cursor: pointer;
  
        &.active {
          background: #00a0e9;
          color: #fff;
        }
      }
    }
  }
  </style>
  <style>
  .tableBox {
    width: 100%;
    border: 1px solid rgba(0, 0, 0, 0.4);
    scrollbar-width: none;
    cursor: pointer;
  }
  .tableBox::-webkit-scrollbar {
    display: none; /* 对于Chrome, Safari和Opera */
  }
  .tableBox div {
    box-sizing: border-box;
    text-align: center;
  }
  .scrollbar {
    scrollbar-width: none;
  }
  .scrollbar::-webkit-scrollbar {
    display: none; /* 对于Chrome, Safari和Opera */
  }
  .flexbox {
    display: flex;
    justify-content: center;
    align-items: center;
  }
  .height40 {
    min-height: 40px;
  }
  .bor_btm {
    border-bottom: 1px solid rgba(0, 0, 0, 0.4);
  }
  .bor_right {
    border-right: 1px solid rgba(0, 0, 0, 0.4);
  }
  .flex_1 {
    flex: 1;
  }
  .pad8 {
    padding: 4px;
  }
  .flex_column {
    flex-direction: column;
  }
  .calc1 {
    width: calc(100% / 14);
  }
  .calc2 {
    width: calc((100% / 14) * 2);
  }
  .calc3 {
    width: calc((100% / 14) * 3);
  }
  .calc4 {
    width: calc((100% / 14) * 4);
  }
  .calc5 {
    width: calc((100% / 14) * 5);
  }
  .calc6 {
    width: calc((100% / 14) * 6);
  }
  .calc7 {
    width: calc((100% / 14) * 7);
  }
  .calc8 {
    width: calc((100% / 14) * 8);
  }
  .calc9 {
    width: calc((100% / 14) * 9);
  }
  .calc10 {
    width: calc((100% / 14) * 10);
  }
  .calc11 {
    width: calc((100% / 14) * 11);
  }
  .calc12 {
    width: calc((100% / 14) * 12);
  }
  </style>
    <script>
  export default { name: "ledger:ledger_report_detail" };
  </script>